<template>
	<view>
		<cu-custom class="text-Black" bgColor="bg-red" :isBack="true">		<block slot="backText"></block>
			<block slot="content">意见反馈</block>
		</cu-custom>
		<view class="cu-bar bg-white margin-top">
			<view class="action">
				问题/意见
			</view>
			<view class="action">
			</view>
		</view>
		<view class="cu-form-group">
			<textarea maxlength="-1" v-model="formData.content" placeholder="请输入问题/意见"></textarea>
		</view>
		<ImageUploadView ref="ImageUploadView"></ImageUploadView>

		<view class="cu-form-group margin-top">
			<view class="title">类型</view>
			<view>
				<radio-group class="block" @change="RadioChange">
					<radio class='margin-right-sm' :class="formData.type=='1'?'checked':''" :checked="formData.type=='1'?true:false"
					 value="1">功能建议</radio>
					<radio class='margin-right-sm' :class="formData.type=='2'?'checked':''" :checked="formData.type=='2'?true:false"
					 value="2">Bug反馈</radio>
					<radio class='' :class="formData.type=='3'?'checked':''" :checked="formData.type=='3'?true:false" value="3">业务咨询</radio>
				</radio-group>
			</view>
		</view>

		<view class="cu-form-group margin-top">
			<view class="title">类型方式</view>
			<input placeholder="QQ/邮箱/手机号" name="input" v-model="formData.contact_way" class="text-right"></input>
		</view>

		<view class="margin margin-top-xl">
			<view class="cu-btn lg w100  round" :class="'bg-'+theme" @tap="onSubmit">提交</view>
		</view>
	</view>
</template>

<script>
	import ImageUploadView from '@/components/default/ImageUploadView.vue'
	export default {
		components: {
			ImageUploadView
		},
		data() {
			return {
				formData: {
					contact_way: '',
					type: 1,
					content: '',
					covers: ''
				},
				theme: this.$config.THEME(),
			}
		},
		onLoad(options) {},
		methods: {
			onSubmit() {
				this.$refs.ImageUploadView.getUploadList().then((res) => {
					this.formData.covers = JSON.stringify(res)
					this.$http
						.post('opinion_create', this.formData)
						.then((response) => {
							this.$common.showSuccess('提交成功，请耐心等待回复')
						})
						.catch((response) => {})
				})

			},
			RadioChange(e) {
				this.formData.type = e.detail.value
			}
		},
	}
</script>

<style>
</style>
